<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>添加用户</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="__STATIC__/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="__STATIC__/css/font_eolqem241z66flxr.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form" action="{:URL('index/acl/addUser')}" method="post">
		<div class="layui-form-item">
			<label class="layui-form-label">用户名：</label>
			<div class="layui-input-block">
				<input type="text" name="admin_name" class="layui-input newsName" lay-verify="required" placeholder="请输入用户名">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">用户密码：</label>
			<div class="layui-input-block">
				<input type="text" name="admin_pwd" class="layui-input newsName" lay-verify="required" placeholder="请输入密码">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">确认密码：</label>
			<div class="layui-input-block">
				<input type="text" name="admin_rpwd" class="layui-input newsName" lay-verify="required" placeholder="请输入确认密码">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">用户角色：</label>
			<div class="layui-input-block">
				{foreach $roles as $v}
					<input type="checkbox" name="roles[]" lay-skin="primary" value="{$v->role_id}">
					<div class="layui-unselect layui-form-checkbox" lay-skin="primary" ><i class="layui-icon"></i></div><sub><i>{$v->role_name}</i></sub>
				{/foreach}
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="addUser">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
		    </div>
		</div>
	</form>
	<script type="text/javascript" src="__STATIC__/js/jquery-3.2.1.min.js"></script>
	<script type="text/javascript" src="__STATIC__/layui/layui.js"></script>
</body>
<script>
$(function(){
   $('.layui-form-checkbox').click(function(){
       console.log($(this).prev().prop('checked'));
       if(!$(this).prev().prop('checked')){
           $(this).addClass('layui-form-checked');
           $(this).prev().prop('checked',true);
	   }else{
           $(this).removeClass('layui-form-checked');
           $(this).prev().prop('checked',false);
	   }
   });
});

</script>
</html>